var ClubBaseSetting = Item.extend({
    _ccsFileName: res.ClubBaseSetting_json,
    _clubId: null,
    _input_clubName: null,
    _input_clubNotice: null,

    initItem: function (clubId) {
        this._clubId = clubId;
        var clubInfo = ClubDataManager.getClubData(this._clubId);
        this._input_clubName = this._nodeList['input_clubName'];
        this._input_clubNotice = this._nodeList['input_clubNotice'];
        this._input_clubName.setString(clubInfo.name);
        this._input_clubNotice.setString(clubInfo.notice);

    },
    _initClickListeners: function () {
        this._clickListeners = {
            'btn_save': '_handleSave',
        };
    },

    _handleSave: function () {
        this._handleSaveClubName();
        this._handleSaveClubNotice();
    },

    _handleSaveClubName:function () {
        //修改名字
        this._input_clubName.didNotSelectSelf();
        var nameStr = this._input_clubName.getString();

        var tip = '';
        var str = nameStr;
        if (str == null || str == undefined || str == '') {
            tip = '亲友圈名称为空';
        }
        if (tip == '' && (str.length < 2 || str.length > 17)) {
            tip = '群名称长度在2-16字符之间';
        }
        if (tip == '') {
            network.send(2103, {cmd: ClubMsgCode.ModifyClub, club_id: this._clubId, name: str});
        } else {
            showAlert(tip);
            return;
        }
    },

    _handleSaveClubNotice: function(){
        //修改通知
        var str = this._input_clubNotice.getString();
        if (str.length <= 0) {
            showAlert('公告不能为空');
            return;
        }
        if (str.length > 20) {
            showAlert('最多20个汉字或者数字');
            return;
        }
        network.send(2103, {cmd: ClubMsgCode.ModifyClub, club_id: this._clubId, notice: str});
    }
});